/*
 * Main.java
 *
 * Created on March 28, 2007, 11:24 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package catalogueclienttest1;

import java.util.Hashtable;
import javax.ejb.EJB;
import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingEnumeration;
import usyd.comp5348.Catalogue;
import usyd.comp5348.CatalogueRemote;

/**
 *
 * @author david
 */
public class Main {
    
    @EJB
    private static CatalogueRemote catalogueBean;
    
    /** Creates a new instance of Main */
    public Main() throws Exception {
        Context initialContext = new InitialContext();
        catalogueBean = (CatalogueRemote) initialContext.lookup("Catalogue");
        doStuff();
    }
    
    public void doStuff() throws Exception {
        Catalogue a = new Catalogue();
        a.setCatalogueNumber("1");
        a.setDirector("b");
        a.setGenre("c");
        a.setPrice(12.12);
        a.setTitle("d");
        int i = catalogueBean.createVideo(a);
        System.out.println("Got back video: " + i);
        a = catalogueBean.getVideoById(201);
        System.out.println("ID: " + a.getId() + ", TITLE: " + a.getTitle());
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        try {
            Main m = new Main();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
}
